package com.nan.hrm;

import com.nan.hrm.doc.CourseDoc;
import com.nan.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseEsClientHystrixFallbackFactory implements
        FallbackFactory<CourseEsClient> {
    @Override
    public CourseEsClient create(Throwable throwable) {
        return new CourseEsClient() {
            @Override
            public AjaxResult save(CourseDoc courseDoc) {
                return AjaxResult.me().setSuccess(false).setResultObj("降级处理");
            }

            @Override
            public AjaxResult delete(Long id) {
                return AjaxResult.me().setSuccess(false).setResultObj("降级处理");
            }
        };
    }
}
